Blockchain transaction processing method and apparatus

ABSTRACT

Disclosed herein are methods, systems, and apparatus, including computer programs encoded on computer storage media, for blockchain transaction processing. One of the methods includes: obtaining, by a blockchain node, a current blockchain transaction generated based on performing a service; obtaining, by the blockchain node based on executing a smart contract, a transaction identifier of a previous blockchain transaction; recording, by the blockchain node, the transaction identifier into a transaction log so that a previous blockchain transaction is identifiable from the transaction log based on the transaction identifier, wherein the transaction log stores blockchain transactions of the current block; and recording the blockchain transaction of the current block and the transaction log into the blockchain.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of PCT Application No.PCT/CN2020/071331, filed on Jan. 10, 2020, which claims priority toChinese Patent Application No. 201910817713.X, filed on Aug. 30, 2019,and each application is hereby incorporated by reference in itsentirety.

TECHNICAL FIELD

Implementations of the present specification relate to the field ofinformation technologies, and in particular, to blockchain transactionprocessing methods and apparatuses.

BACKGROUND

Currently, it is a trend to combine a blockchain technology with aservice. In some service fields, a service task can generate a series ofrelated blockchain transactions in a certain order. These blockchaintransactions are submitted in the generating order to a blockchainnetwork for storage.

In practice, if the progress of a service task needs to be known, allthe blockchain transactions generated by the service task need to bequeried, and the blockchain needs to be traversed, which is inefficient.

SUMMARY

To improve the efficiency of querying related blockchain transactionsgenerated by a service task, implementations of the presentspecification provide blockchain transaction processing methods andapparatuses. Technical solutions are as follows:

According to a first aspect of the implementations of the presentspecification, a blockchain transaction processing method is provided.The method includes the following:

Each node in a blockchain network performs the following operations:obtaining a blockchain transaction generated by any service task in aspecified service, and using the blockchain transaction as a currentblockchain transaction; invoking a pre-deployed smart contractcorresponding to the specified service; obtaining, based on the smartcontract, a transaction identifier of a previous blockchain transactiongenerated by the service task, and writing the obtained transactionidentifier into a transaction log of the current blockchain transaction;and writing the current blockchain transaction and the transaction logof the current blockchain transaction into a blockchain, where when anyblockchain transaction generated by the service task is obtained throughquery, a blockchain transaction generated by the service task before theblockchain transaction can be further obtained through query based onthe transaction log of the blockchain transaction.

According to a second aspect of the implementations of the presentspecification, a blockchain transaction processing apparatus isprovided. The apparatus is any node in a blockchain network. Theapparatus includes the following: an acquisition module, configured toobtain a blockchain transaction generated by any service task in aspecified service, and use the blockchain transaction as a currentblockchain transaction; an invoking module, configured to invoke apre-deployed smart contract corresponding to the specified service; aprocessing module, configured to obtain, based on the smart contract, atransaction identifier of a previous blockchain transaction generated bythe service task, and write the obtained transaction identifier into atransaction log of the current blockchain transaction; and an on-chainmodule, configured to write the blockchain transaction and thetransaction log of the current blockchain transaction into a blockchain,where when any blockchain transaction generated by the service task isobtained through query, a blockchain transaction generated by theservice task before the blockchain transaction can be further obtainedthrough query based on the transaction log of the blockchaintransaction.

In the technical solutions provided by the implementations of thepresent specification, by using the smart contract deployed in theblockchain network, for each blockchain transaction generated by aservice task, a transaction identifier of a previous blockchaintransaction generated by the service task before the blockchaintransaction is written into the transaction log of the blockchaintransaction. Because both a blockchain transaction and a correspondingtransaction log are written into a blockchain, the user can obtain theprevious related blockchain transaction of the blockchain transactionthrough query based on the transaction identifier in the transaction logof the blockchain transaction when the user subsequently requests toquery a blockchain transaction generated in the service task. As such,the user can obtain all related blockchain transactions before theblockchain transaction currently requested to be queried, instead oftraversing the blockchain, thereby improving query efficiency.

It should be understood that the previous general description and thefollowing detailed description are merely example and illustrative, andcannot limit the implementations of the present specification.

In addition, any one of the implementations of the present specificationdoes not need to implement all the previous effects.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the implementations of thepresent specification or in the existing technology more clearly, thefollowing briefly describes the accompanying drawings required fordescribing the implementations or the existing technology. Clearly, theaccompanying drawings in the following description merely show someimplementations of the present specification, and a person of ordinaryskill in the art can still derive other drawings from these accompanyingdrawings.

FIG. 1 is a schematic architectural diagram illustrating a blockchaintransaction query system, according to an implementation of the presentspecification;

FIG. 2 is a schematic flowchart illustrating a blockchain transactionquery method, according to an implementation of the presentspecification;

FIG. 3 is a schematic flowchart illustrating a blockchain transactionprocessing method, according to an implementation of the presentspecification;

FIG. 4 is a schematic flowchart illustrating a blockchain transactionprocessing method, according to an implementation of the presentspecification;

FIG. 5 is a schematic flowchart illustrating a blockchain transactionprocessing method, according to the present specification;

FIG. 6 is a schematic flowchart illustrating a blockchain transactionquery method processed in the method shown in FIG. 5, according to animplementation of the present specification;

FIG. 7 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to the present specification;

FIG. 8 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to the present specification;

FIG. 9 is a schematic structural diagram illustrating a blockchaintransaction processing apparatus, according to the presentspecification;

FIG. 10 is a schematic structural diagram illustrating a presentationinformation query apparatus, according to an implementation of thepresent specification;

FIG. 11 is a schematic structural diagram illustrating a presentationinformation query apparatus, according to an implementation of thepresent specification;

FIG. 12 is a schematic structural diagram illustrating a blockchaintransaction processing apparatus, according to an implementation of thepresent specification;

FIG. 13 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to an implementation of thepresent specification;

FIG. 14 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to an implementation of thepresent specification; and

FIG. 15 is a schematic structural diagram illustrating a computer devicefor configuring the apparatus, according to an implementation of thepresent specification.

DESCRIPTION OF IMPLEMENTATIONS

To make a person skilled in the art understand the technical solutionsin the implementations of the present specification better, thefollowing clearly and comprehensively describes the technical solutionsin the implementations of the present specification with reference tothe accompanying drawings in the implementations of the presentspecification. Clearly, the described implementations are merely somebut not all of the implementations of the present specification. Allother implementations obtained by a person of ordinary skill in the artbased on the implementations of the present specification shall fallwithin the protection scope of the present specification.

The technical solutions provided in the implementations of the presentspecification are described in detail below with reference to theaccompanying drawings.

FIG. 1 is a schematic architectural diagram illustrating a blockchaintransaction query system, according to an implementation of the presentspecification. As shown in FIG. 1, the system includes a consortiumchain network, a query server, and at least one query client.

The consortium chain network is a consortium blockchain network formedby node devices respectively controlled by a plurality of organizationmembers. In practice, a blockchain transaction generated by a servicecan be submitted to the consortium chain network for storage.

The query server is a centralized device introduced in theimplementations of the present specification and interconnected with theconsortium chain network. The query server has permission to access ablockchain on at least one node in the consortium chain network.Certainly, the consortium chain network can also grant no permission tothe query server to access the blockchain.

In practice, the query server is a server of a blockchain as a service(BaaS) platform. The consortium chain network can be initiated andestablished by using the BaaS platform. The administrator of theconsortium chain network can log in to the BaaS platform to configureparameters of the consortium chain network (for example, a quantity ofnodes, a consensus protocol, whether to authorize a user to access, andwhich user is authorized with access permission).

A typical client-server (C/S) architecture is between the query clientand the query server. The query server can correspond to more than onequery client, and each query client corresponds to one user. When theuser wants to query the blockchain transaction stored in the consortiumchain network, the user needs to request the query server for queryproxy by using the query client installed on a device (for example, amobile phone or a computer) of the user.

The query server creates in advance a query service interfacecorresponding to each blockchain transaction stored in the consortiumchain network, and exposes the created query service interface to eachquery client. The query service interface is actually an applicationprogramming interface (API). The query server exposes the APIcorresponding to each blockchain transaction to the query client, whichmeans that the query client can invoke an API to initiate a queryrequest for the blockchain transaction corresponding to the API.

Any query client determines, as a target query service interface, aquery service interface specified by a user; invokes the target queryservice interface of the query server; and provides a blockchaintransaction received from the query server for the user.

When detecting that the target query service interface is invoked, thequery server obtains a blockchain transaction corresponding to thetarget query service interface from the consortium chain network, andreturns the obtained blockchain transaction to the query client.

It can be seen from the following implementations that the query servercan also return presentation information in a transaction logcorresponding to the target query service interface to the query clientfor presentation, and can further query each related blockchaintransaction before the blockchain transaction corresponding to thetarget query service interface and presentation information in acorresponding transaction log based on a transaction identifier of aprevious related blockchain transaction in the transaction log of theblockchain transaction corresponding to the target query serviceinterface, and return the further queried information to the queryclient.

FIG. 2 is a schematic flowchart illustrating a blockchain transactionquery method, according to an implementation of the presentspecification. The method includes the following steps:

S200. A query client determines, as a target query service interface, aquery service interface specified by a user.

In the implementation of the present specification, when the user needsto query a blockchain transaction, the user can input a transactionidentifier of the blockchain transaction (generally, a hash value of theblockchain transaction) to the query client, and the query clientdetermines, based on the transaction identifier input by the user, ablockchain transaction to be queried by the user and further determinesa query service interface to be invoked.

Further, the query server can determine a corresponding uniform resourcelocator (URL) for each query service interface, and deliver the URL tothe query client. The query client presents the URL corresponding toeach query service interface to the user. The user triggers the URL tospecify the query service interface to be invoked.

Further, the query server can encode the URL corresponding to each queryservice interface to obtain a barcode (one-dimensional barcode,two-dimensional barcode, etc.), and deliver the barcode to the queryclient. A user can present a barcode of a query service entrycorresponding to a blockchain transaction to another user through aquery client of the user. Another user can scan the barcode by using aquery client of the another user and trigger the query client to invokea corresponding query service entry.

That is, the query client scans a barcode specified by the user, parsesout an interface identifier included in the barcode, and further usesthe query service interface corresponding to the interface identifierobtained through parsing as the target query service interface.

In the implementation of the present specification, the query client candetermine whether the user has blockchain transaction query permission,and in response to determining that the user has blockchain transactionquery permission, determine the query service interface specified by theuser.

Alternatively, the query client determines whether the user hasblockchain transaction query permission, and in response to determiningthat the user has blockchain transaction query permission, invokes thetarget query service interface of the query server.

In the implementation of the present specification, the administrator ofthe consortium chain network (generally specified by an organizationmember of initiating the consortium chain network) can configure querypermission on the BaaS platform (namely, the query server). Theadministrator can specify identities of some users (for example, amobile number, an identity card number, and an account number) to thequery server. The users with these identities are authorized to query ablockchain transaction in the consortium chain network. The query serverrecords these identities having the query permission.

The query client determines whether the user has blockchain transactionquery permission. The query client can send the identity information ofthe user to the query server. The query server determines, based on thereceived identity information, whether the user corresponding to theidentity information is in users having the blockchain transaction querypermission that are specified in advance by the specifying organizationmember; and if yes, notifies the query client that the usercorresponding to the identity information has the blockchain transactionquery permission; otherwise, notifies the query client that the usercorresponding to the identity information does not have the blockchaintransaction query permission.

S202. The query client invokes the target query service interface of thequery server.

S204. When detecting that the target query service interface is invoked,the query server obtains a blockchain transaction corresponding to thetarget query service interface from the consortium chain network.

S206. Return the obtained blockchain transaction to the query client.

In the implementation of the present specification, a specifyingorganization member of the consortium chain network grants a permissioncertificate of the specifying organization member to the query server inadvance, and the permission certificate is used to access a blockchainon a node controlled by the specifying organization member.

When detecting that the target query service interface is invoked, thequery server can access the blockchain on the node controlled by thespecifying organization member by using the permission certificategranted by the specifying organization member in advance; and read theblockchain transaction corresponding to the target query serviceinterface from the accessed blockchain.

In the implementation of the present specification, the query server candetermine whether content of the obtained blockchain transactionviolates a predetermined content review rule; and if the content of theobtained blockchain transaction does not violate the predeterminedcontent review rule, return the obtained blockchain transaction to thequery client. For example, the query server can detect transactioncontent in the obtained blockchain transaction based on the keyworddetection technology. If the transaction content involves pornography,it is determined that the transaction does not confirm with the contentreview rule. In this case, the blockchain transaction is prevented frombeing returned to the query client.

S208. The query client queries the received blockchain transaction forthe user.

In the implementation of the present specification, the query server canrecord each invoking event of the query service interface. Informationabout the event includes a time, a location, identity information of arequested user, etc. Alternatively, an event that each user queries ablockchain transaction can be recorded.

In the method shown in FIG. 2, the centralized “query server-queryclient” architecture is introduced. A query server is interconnectedwith a consortium chain network. A query service interface iscorrespondingly created for each blockchain transaction stored in theconsortium chain network. The query service interface corresponding toeach blockchain transaction is exposed to a query client. The userqueries a blockchain transaction through the query client by invokingthe query service interface, which is easy and efficient.

In addition, the present specification further discloses a blockchaintransaction processing method. The method is used to optimize apresentation form of service information carried in a blockchaintransaction, so that the service information is presented to the usermore friendly. It is worthwhile to note that the blockchain transactionprocessing method disclosed in the present specification is not limitedto optimizing the presentation form of the service information of theblockchain transaction stored in the consortium chain network, and canfurther optimize a presentation form of service information in ablockchain transaction stored in another type of blockchain network (forexample, a public chain network).

FIG. 3 is a schematic flowchart illustrating a blockchain transactionprocessing method, according to an implementation of the presentspecification. Each node in a blockchain network executes the followingsteps:

S300. Obtain a blockchain transaction generated by a specified service.

In the present specification, the blockchain transaction generated bythe service means a blockchain transaction initiated by a userparticipating in a service during service operation. The blockchaintransaction includes service information.

In the implementation of the present specification, a blockchain networkcan interconnect with a plurality of services at the same time. Forexample, the blockchain network can interconnect with a data storageservice and a product tracing service. A blockchain transaction iscorrespondingly generated each time a piece of data needs to be storedin the data storage service. Service information carried in theblockchain transaction can be a hash value of data to be stored. Ablockchain transaction is correspondingly generated each time a flow ofa product needs to be recorded in the product tracing service. Serviceinformation carried in the blockchain transaction can be recordinformation related to the product in the flow.

The specified service can be one of a plurality of servicesinterconnected with a blockchain network. For ease of description, themethod in FIG. 3 is for the specified service.

S302. Invoke a pre-deployed smart contract corresponding to thespecified service.

In the implementation of the present specification, to alleviate aproblem that service information in a blockchain transaction is notsuitable to be presented to a user, a smart contract corresponding to aspecified service is deployed in a blockchain network. The smartcontract is used to implement a function of determining, based on theservice information in the blockchain transaction, presentationinformation suitable to be presented to the user. It can be understoodthat if a plurality of services are interconnected with the blockchainnetwork, a smart contract corresponding to each service needs to bedeployed in the blockchain network.

After obtaining the blockchain transaction generated by the specifiedservice, each node in the blockchain network needs to invoke the smartcontract corresponding to the specified service to process theblockchain transaction.

S304. Determine presentation information based on the smart contract andthe service information.

S306. Write the determined presentation information into a transactionlog of the blockchain transaction based on the smart contract; or writea hash value of the determined presentation information into atransaction log of the blockchain transaction, and store the determinedpresentation information.

Steps S304 to S306 provide a process of processing a blockchaintransaction by using a smart contract.

Determining the presentation information based on the serviceinformation can be converting the service information into presentationinformation used to be presented to the user. For example, the serviceinformation is a segment of abstract code. In this case, the code isconverted into text language for the user to understand.

Determining the presentation information based on the serviceinformation can alternatively be selecting presentation informationmatching the service information from predetermined presentationinformation.

Certainly, in practice, there can be a plurality of methods fordetermining the presentation information based on the serviceinformation, which is not limited in the present specification.

In the implementation of the present specification, the determinedpresentation information can be encrypted by using an encryption keyprovided by an initiator of the blockchain transaction, and theencrypted presentation information is written into a transaction log ofthe blockchain transaction. If the asymmetric encryption technology isused, the encryption key can be a public key of the initiator of theblockchain transaction. In this case, only the initiator of theblockchain transaction can perform decryption by using the private keyof the initiator.

In the implementation of the present specification, the determinedpresentation information can be encrypted by using the encryption keyprovided by the initiator of the blockchain transaction, and theencrypted presentation information is stored.

In the implementation of the present specification, the smart contractcorresponding to the specified service can further include a datastructure agreed upon in advance with the query client. In this case, byusing the smart contract, presentation information encapsulated based onthe data structure can be determined based on the service informationand the data structure in the smart contract.

S308. Write the blockchain transaction and the transaction log of theblockchain transaction into a blockchain.

When a user requests to query the blockchain transaction, thepresentation information in the transaction log is presented to theuser.

In the method shown in FIG. 3, the smart contract corresponding to thespecified service is deployed in the blockchain network to determine,based on the service information carried in the blockchain transactiongenerated by the specified service, the presentation informationsuitable to be presented to the user. The determined presentationinformation is written into the transaction log of the blockchaintransaction as an execution result of the blockchain transaction.Because both the blockchain transaction and the correspondingtransaction log are written into a blockchain, the presentationinformation in the transaction log of the blockchain transaction can bepresented to the user when the user subsequently requests to query theblockchain transaction.

FIG. 4 is a schematic flowchart illustrating a presentation informationquery method shown in FIG. 3, according to an implementation of thepresent specification. The method includes the following steps:

S400. A query client determines, as a target query service interface, aquery service interface specified by a user.

S402. The query client invokes the target query service interface of thequery server.

S404. When detecting that the target query service interface is invoked,the query server obtains a transaction log of a blockchain transactioncorresponding to the target query service interface from the consortiumchain network.

S406. The query server extracts presentation information from thetransaction log, and returns the presentation information to the queryclient.

S408. The query client presents the received presentation information tothe user.

The method shown in FIG. 4 is actually based on the architecture shownin FIG. 1. When the user requests to query a blockchain transaction,presentation information corresponding to service information carried inthe blockchain transaction can also be obtained through query. The queryclient presents the presentation information to the user so that theuser can better understand the service information in the blockchaintransaction.

In the method shown in FIG. 4, if the presentation information has beenencrypted by an encryption key of the user, the query client decryptsthe received presentation information by using a decryption key of theuser, and presents the decrypted presentation information to the user.

In addition, data structure parsing logic can be embedded in the queryclient to parse data encapsulated based on a predetermined datastructure. The presentation information is encapsulated based on thedata structure. In this case, the query client can parse the receivedpresentation information based on the embedded data structure parsinglogic, and present the parsed presentation information to the user.

In addition, the present specification further discloses a blockchaintransaction processing method, which is used to improve efficiency ofquerying a series of related blockchain transactions generated by aservice task. It is worthwhile to note that the blockchain transactionprocessing method disclosed in the present specification is not limitedto improving efficiency of querying the blockchain transaction stored inthe consortium chain network, and can further improve efficiency ofquerying a blockchain transaction stored in another type of blockchainnetwork (for example, a public chain network).

FIG. 5 is a schematic flowchart illustrating a blockchain transactionprocessing method, according to the present specification. The methodincludes the following steps:

S500. Obtain a blockchain transaction generated by any service task in aspecified service, and use the blockchain transaction as a currentblockchain transaction.

In the present specification, the service task in the specified servicemeans a continuous service task generated in a process of running thespecified service. In a process of executing the service task, a seriesof related blockchain transactions need to be generated and submitted toa blockchain network for storage. For example, in the product tracingservice, a service task for product A is generated. A correspondingblockchain transaction needs to be generated for each phase in whichproduct A is delivered from a factory to a customer and submitted to theblockchain network for storage. A transport process of product A is aservice task. A series of blockchain transactions generated by theservice task are related to each other. The transport process of productA is jointly recorded.

S502. Invoke a pre-deployed smart contract corresponding to thespecified service.

In the implementation of the present specification, the smart contractcorresponding to the specified service is deployed in the blockchainnetwork. The smart contract is used to implement a function of writing atransaction identifier of a previous related blockchain transaction intoa transaction log of a currently processed blockchain transaction.

After obtaining the blockchain transaction generated by the specifiedservice, each node in the blockchain network needs to invoke the smartcontract corresponding to the specified service to process theblockchain transaction.

S504. Obtain, based on the smart contract, a transaction identifier of aprevious blockchain transaction generated by the service task, and writethe obtained transaction identifier into a transaction log of thecurrent blockchain transaction.

Step S504 provides a process of processing the blockchain transaction byusing the smart contract.

In the implementation of the present specification, for any blockchaintransaction, the transaction identifier of the blockchain transaction isa hash value obtained by performing hash calculation on the blockchaintransaction.

In the implementation of the present specification, the smart contractcorresponding to the specified service can maintain an identifier recordtable corresponding to the service task. In this case, after theobtained transaction identifier is written into the transaction log ofthe current blockchain transaction, the transaction identifier of thecurrent blockchain transaction can be used as an identifier record andbe added to the identifier record table. In addition, obtaining thetransaction identifier of the previous blockchain transaction generatedby the service task can be reading the transaction identifier from anidentifier record recently added to the identifier record table.

In addition, the smart contract corresponding to the specified servicecan be used to maintain an identifier record corresponding to theservice task. In this case, after the obtained transaction identifier iswritten into the transaction log of the current blockchain transaction,the transaction identifier in the identifier record can be updated tothe transaction identifier record of the current blockchain transaction.In addition, obtaining the transaction identifier of the previousblockchain transaction generated by the service task can be reading thetransaction identifier from the identifier record.

In the implementation of the present specification, the obtainedtransaction identifier can be encrypted by using an encryption keyrelated to the service task. The encrypted transaction identifier iswritten into the transaction log of the current blockchain transaction.

S506. Write the current blockchain transaction and the transaction logof the current blockchain transaction into a blockchain.

When any blockchain transaction generated by the service task isobtained through query, a previous blockchain transaction generated bythe service task before the blockchain transaction can be furtherobtained through query based on the transaction log of the blockchaintransaction.

In the method shown in FIG. 5, by using the smart contract deployed inthe blockchain network, for each blockchain transaction generated by aservice task, a transaction identifier of a previous blockchaintransaction generated by the service task before the blockchaintransaction is written into the transaction log of the blockchaintransaction. Because both a blockchain transaction and a correspondingtransaction log are written into a blockchain, the user can obtain theprevious related blockchain transaction of the blockchain transactionthrough query based on the transaction identifier in the transaction logof the blockchain transaction when the user subsequently requests toquery a blockchain transaction generated in the service task. As such,the user can obtain all related blockchain transactions before theblockchain transaction currently requested to be queried, instead oftraversing the blockchain, thereby improving query efficiency.

FIG. 6 is a schematic flowchart illustrating a blockchain transactionquery method processed in the method shown in FIG. 5, according to animplementation of the present specification. The method includes thefollowing steps:

S600. A query client determines a query service interface specified by auser as a target query service interface.

S602. The query client invokes a target query service interface of thequery server.

S604. When detecting that the target query service interface is invoked,the query server obtains a blockchain transaction corresponding to thetarget query service interface and a corresponding transaction log fromthe consortium chain network.

S606. The query server returns, to the query client, a blockchaintransaction corresponding to the target query service interface.

S608. Cyclically perform the following steps S6081 to S6084, until apredetermined stop condition is satisfied.

The predetermined stop condition can be that a specified quantity ofblockchain transactions has been returned to the query client, or can bethat all related blockchain transactions generated before the blockchaintransactions corresponding to the target query service interface havebeen returned to the query client.

S6081. Use a transaction log of the blockchain transaction correspondingto the target query service interface as a target transaction log.

S6082. Extract a transaction identifier from the target transaction log,and obtain a blockchain transaction corresponding to the extractedtransaction identifier and a corresponding transaction log from theconsortium chain network.

S6083. Return the blockchain transaction corresponding to the extractedtransaction identifier to the query client.

S6084. Use a transaction log of the blockchain transaction correspondingto the extracted transaction identifier as a target transaction log.

The method shown in FIG. 6 is actually based on the architecture shownin FIG. 1. When the user requests to query a blockchain transaction, allrelated blockchain transactions generated before the blockchaintransaction can be obtained through query. The query client alsopresents a series of related blockchain transactions to the user toavoid traversing in the blockchain.

In the method shown in FIG. 6, extracting the transaction identifierfrom the target transaction log can be extracting, from the targettransaction log, a transaction identifier encrypted by using anencryption key related to a specified service task. The blockchaintransaction corresponding to the target query service interface isgenerated in the specified service task. Then, the transactionidentifier in the target transaction log is decrypted by using thedecryption key related to the specified service task.

In addition, it is worthwhile to note that the implementations disclosedin the present specification can be combined. In practice, based on thesystem architecture shown in FIG. 1, a blockchain browser function canbe set in the query client of the user. The user requests to query ablockchain transaction by using the query client. The query serverconducts the query instead, returns the blockchain transaction andpresentation information in a corresponding transaction log to the user,and returns, to the query client based on a transaction identifier of aprevious related blockchain transaction in the transaction log, allrelated blockchain transactions before the blockchain transactionsinitially obtained by the user through query (related blockchaintransactions are blockchain transactions generated in the same servicetask) and presentation information in the corresponding transaction log,and presents the related blockchain transactions and the presentationinformation to the user.

FIG. 7 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to the present specification. Aquery server creates a query service interface corresponding to eachblockchain transaction stored in a consortium chain network in advance,and exposes the created query service interface to the apparatus.

The apparatus includes the following: a determining module 701,configured to determine a query service interface specified by a user asa target query service interface; an invoking module 702, configured toinvoke the target query service interface of the query server so thatthe query server obtains a blockchain transaction corresponding to thetarget query service interface from the consortium chain network andreturns the obtained blockchain transaction to the query client whendetecting that the target query service interface is invoked; and aproviding module 703, configured to provide the received blockchaintransaction for the user.

FIG. 8 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to the present specification. Theapparatus creates a query service interface corresponding to eachblockchain transaction stored in a consortium chain network in advance,and exposes the created query service interface to a query client.

The apparatus includes the following: a processing module 801,configured to obtain a blockchain transaction corresponding to thetarget query service interface from the consortium chain network basedon an invoking request, and return the obtained blockchain transactionto the query client so that the query client provides the receivedblockchain transaction for the user.

The invoking request is an invoking request sent by the query client forthe target query service interface, and the target query serviceinterface is a user-specified query service interface determined by thequery client.

FIG. 9 is a schematic structural diagram of a blockchain transactionprocessing apparatus, according to the present specification. Theapparatus is any node in a blockchain network. The apparatus includesthe following: an obtaining module 901, configured to obtain ablockchain transaction generated by a specified service, where theblockchain transaction carries service information; an invoking module902, configured to invoke a pre-deployed smart contract corresponding tothe specified service; a determining module 903, configured to determinepresentation information based on the smart contract and the serviceinformation; a processing module 904, configured to write the determinedpresentation information into a transaction log of the blockchaintransaction based on the smart contract; or write a hash value of thedetermined presentation information into a transaction log of theblockchain transaction, and store the determined presentationinformation; and an on-chain module 905, configured to write theblockchain transaction and the transaction log of the blockchaintransaction into a blockchain.

When a user requests to query the blockchain transaction, thepresentation information in the transaction log is presented to theuser.

FIG. 10 is a schematic structural diagram illustrating a presentationinformation query apparatus, according to an implementation of thepresent specification. A query server creates a query service interfacecorresponding to each blockchain transaction stored in a consortiumchain network in advance, and exposes the created query serviceinterface to the apparatus.

The apparatus includes the following: a determining module 1001,configured to determine a query service interface specified by a user asa target query service interface; an invoking module 1002, configured toinvoke the target query service interface of the query server, so thatthe query server obtains a transaction log of a blockchain transactioncorresponding to the target query service interface from the consortiumchain network when detecting that the target query service interface isinvoked, and the query server extracts presentation information from thetransaction log and returns the presentation information to the queryclient; and a presentation module 1003, configured to present thereceived presentation information to the user.

FIG. 11 is a schematic structural diagram illustrating a presentationinformation query apparatus, according to an implementation of thepresent specification. The apparatus creates a query service interfacecorresponding to each blockchain transaction stored in a consortiumchain network in advance, and exposes the created query serviceinterface to a query client.

The apparatus includes the following: an acquisition module 1101,configured to: when detecting that the target query service interface isinvoked, obtain a transaction log of a blockchain transactioncorresponding to the target query service interface from the consortiumchain network, where the target query service interface is a queryservice interface specified by the user to the query client; and anextraction module 1102, configured to extract presentation informationfrom the transaction log and return the presentation information to thequery client, so that the query client presents the receivedpresentation information to the user.

FIG. 12 is a schematic structural diagram of a blockchain transactionprocessing apparatus, according to an implementation of the presentspecification. The apparatus is any node in a blockchain network. Theapparatus includes the following: an acquisition module 1201, configuredto obtain a blockchain transaction generated by any service task in aspecified service, and use the blockchain transaction as a currentblockchain transaction; an invoking module 1202, configured to invoke apre-deployed smart contract corresponding to the specified service; aprocessing module 1203, configured to obtain, based on the smartcontract, a transaction identifier of a previous blockchain transactiongenerated by the service task, and write the obtained transactionidentifier into a transaction log of the current blockchain transaction;and an on-chain module 1204, configured to write the blockchaintransaction and the transaction log of the current blockchaintransaction into a blockchain.

When any blockchain transaction generated by the service task isobtained through query, a blockchain transaction generated by theservice task before the blockchain transaction can be further obtainedthrough query based on the transaction log of the blockchaintransaction.

FIG. 13 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to an implementation of thepresent specification. A query server creates a query service interfacecorresponding to each blockchain transaction stored in a consortiumchain network in advance, and exposes the created query serviceinterface to the apparatus.

The apparatus includes the following: a determining module 1301,configured to determine a query service interface specified by a user asa target query service interface; and an invoking module 1302,configured to invoke the target query service interface of the queryserver, so that the query server obtains a blockchain transactioncorresponding to the target query service interface and a correspondingtransaction log from the consortium chain network when detecting thatthe target query service interface is invoked, and the query serverreturns the blockchain transaction corresponding to the target queryservice interface to the query client and circularly performs thefollowing steps until a predetermined stop condition is satisfied: usingthe transaction log of the blockchain transaction corresponding to thetarget query service interface as a target transaction log; extracting atransaction identifier from the target transaction log, and obtaining ablockchain transaction corresponding to the extracted transactionidentifier and a corresponding transaction log from the consortium chainnetwork; returning the blockchain transaction corresponding to theextracted transaction identifier to the query client; and using thetransaction log of the blockchain transaction corresponding to theextracted transaction identifier as a target transaction log.

FIG. 14 is a schematic structural diagram illustrating a blockchaintransaction query apparatus, according to an implementation of thepresent specification. The apparatus creates a query service interfacecorresponding to each blockchain transaction stored in a consortiumchain network in advance, and exposes the created query serviceinterface to a query client.

The apparatus includes the following: a first processing module 1401,configured to: when detecting that a target query service interface isinvoked, obtain a blockchain transaction corresponding to the targetquery service interface from the consortium chain network and acorresponding transaction log, where the target query service interfaceis a query service interface specified by a user to the query client;and a second processing module 1402, configured to return the blockchaintransaction corresponding to the target query service interface to thequery client and circularly perform the following steps until apredetermined stop condition is satisfied: using a transaction log of ablockchain transaction corresponding to the target query serviceinterface as a target transaction log; extracting a transactionidentifier from the target transaction log, and obtaining the blockchaintransaction corresponding to the extracted transaction identifier and acorresponding transaction log from the consortium chain network;returning the blockchain transaction corresponding to the extractedtransaction identifier to the query client; and using the transactionlog of the blockchain transaction corresponding to the extractedtransaction identifier as a target transaction log.

An implementation of the present specification further provides acomputer device. The computer device includes at least a memory, aprocessor, and a computer program that is stored in the memory and thatcan run on the processor. When the processor executes the program,functions of the method disclosed in the present specification areimplemented.

FIG. 15 is a more detailed schematic diagram illustrating a hardwarestructure of a computing device, according to an implementation of thepresent specification. The device can include a processor 1510, a memory1520, an input/output interface 1530, a communications interface 1540,and a bus 1550. The processor 1510, the memory 1520, the input/outputinterface 1530, and the communications interface 1540 arecommunicatively connected to each other in the device by using the bus1550.

The processor 1510 can be implemented by using a general centralprocessing unit (CPU), a microprocessor, an application-specificintegrated circuit (ASIC), one or more integrated circuits, etc., and isconfigured to execute a related program to implement the technicalsolutions provided in the implementations of the present specification.

The memory 1520 can be implemented by using a read-only memory (ROM), arandom access memory (RAM), a static storage device, a dynamic storagedevice, etc. The memory 1520 can store an operating system and anotherapplication program. When the technical solutions provided in theimplementations of the present specification are implemented by usingsoftware or firmware, related program code is stored in the memory 1520,and is invoked and executed by the processor 1510.

The input/output interface 1530 is configured to be connected to aninput/output module to input/output information. The input/output module(not shown in the figure) can be used as a component and configured inthe device, or can be externally connected to the device to provide acorresponding function. The input module can include a keyboard, amouse, a touchscreen, a microphone, various sensors, etc. The outputmodule can include a display, a speaker, an oscillator, an indicator,etc.

The communications interface 1540 is configured to be connected to acommunications module (not shown in the figure), to implement acommunication interaction between the device and another device. Thecommunications module can implement communication in a wired method (forexample, USB or a network cable), or can implement communication in awireless method (for example, a mobile network, Wi-Fi, or Bluetooth).

The bus 1550 includes a channel used to transmit information betweencomponents (for example, the processor 1510, the memory 1520, theinput/output interface 1530, and the communications interface 1540) ofthe device.

It is worthwhile to note that although only the processor 1510, thememory 1520, the input/output interface 1530, the communicationsinterface 1540, and the bus 1550 of the device are shown, duringspecific implementation, the device can further include other componentsrequired for implementing normal running. In addition, a person skilledin the art can understand that the device can include only componentsnecessary for implementing the solutions in the implementations of thepresent specification, but does not necessarily include all componentsshown in the figure.

An implementation of the present application further provides a computerreadable storage medium. The computer readable storage medium stores acomputer program. When a processor executes the program, functions ofthe method disclosed in the present specification are implemented.

The computer readable medium includes persistent, non-persistent,movable, and unmovable media that can store information by using anymethod or technology. The information can be a computer readableinstruction, a data structure, a program module, or other data. Examplesof the computer storage medium include but are not limited to a phasechange RAM (PRAM), a static RAM (SRAM), a dynamic RAM (DRAM), a RAM ofanother type, a ROM, an electrically erasable programmable ROM (EEPROM),a flash memory or another memory technology, a compact disc ROM(CD-ROM), a digital versatile disc (DVD) or another optical storage, acassette, a cassette magnetic disk storage or another magnetic storagedevice, or any other non-transmission medium. The computer storagemedium can be configured to store information that can be accessed by acomputing device. As described in the present specification, thecomputer readable medium does not include computer readable transitorymedia such as a modulated data signal and a carrier.

It can be seen from the previous descriptions of the implementationsthat, a person skilled in the art can clearly understand that theimplementations of the present specification can be implemented by usingsoftware and a necessary general hardware platform. Based on such anunderstanding, the technical solutions in the implementations of thepresent specification essentially or the part contributing to theexisting technology can be implemented in a form of a software product.The computer software product can be stored in a storage medium, such asa ROM/RAM, a magnetic disk, or an optical disc, and includes severalinstructions for instructing a computer device (which can be a personalcomputer, a server, a network device, etc.) to perform the methoddescribed in the implementations of the present specification or in someparts of the implementations of the present specification.

The system, method, module, or unit illustrated in the previousimplementations can be implemented by using a computer chip or anentity, or can be implemented by using a product having a certainfunction. A typical implementation device is a computer, and thecomputer can be a personal computer, a laptop computer, a cellularphone, a camera phone, an smartphone, a personal digital assistant, amedia player, a navigation device, an email receiving and sendingdevice, a game console, a tablet computer, a wearable device, or anycombination of these devices.

The implementations in the present specification are described in aprogressive way. For same or similar parts of the implementations,references can be made to the implementations. Each implementationfocuses on a difference from other implementations. Particularly, anapparatus implementation is similar to a method implementation, andtherefore is described briefly. For a related part, references can bemade to some descriptions in the method implementation. The previouslydescribed apparatus implementations are merely examples. The modulesdescribed as separate parts may or may not be physically separate.During implementation of the solutions in the implementations of thepresent specification, functions of the modules can be implemented inone or more pieces of software and/or hardware. Some or all of themodules can be selected based on an actual need to implement thesolutions of the implementations. A person of ordinary skill in the artcan understand and implement the implementations of the presentspecification without creative efforts.

The previous descriptions are merely specific implementations of thepresent specification. It is worthwhile to note that a person ofordinary skill in the art can further make several improvements orpolishing without departing from the principle of the implementations ofthe present specification, and the improvements or polishing shall fallwithin the protection scope of the implementations of the presentspecification.

What is claimed is:
 1. A computer-implemented method for blockchaintransaction processing, comprising: obtaining, by a blockchain node of ablockchain, a current blockchain transaction generated based onperforming a service; invoking, by the blockchain node, a smart contractcorresponding to the service, wherein the smart contract comprises atable including a list of transaction identifiers of blockchaintransactions corresponding to the service; obtaining, by the blockchainnode based on executing the smart contract, a transaction identifier ofa previous blockchain transaction, wherein the previous blockchaintransaction corresponds to an identifier record recently added to thelist of transaction identifiers in the table; recording, by theblockchain node, the transaction identifier of the previous blockchaintransaction into a transaction log so that a previous blockchaintransaction is identifiable from the transaction log based on thetransaction identifier; and recording, by the blockchain node, thecurrent blockchain transaction and the transaction log into theblockchain.
 2. The computer-implemented method of claim 1, wherein thetransaction identifier is a hash value of the previous blockchaintransaction.
 3. The computer-implemented method of claim 1, wherein theprevious blockchain transaction is identifiable from the list oftransaction identifiers of blockchain transactions corresponding to theservice.
 4. The computer-implemented method of claim 1, wherein the listof transaction identifiers of blockchain transactions corresponding tothe service is updated based on adding a transaction identifier of thecurrent blockchain transaction into the list, and the transactionidentifier of the previous blockchain transaction is updated in the listas the transaction identifier of the current blockchain transactionafter recording the current blockchain transaction into the blockchain.5. The computer-implemented method of claim 1, wherein the transactionidentifier is encrypted by an encryption key associated with the servicebefore recording into the transaction log.
 6. The computer-implementedmethod of claim 1, further comprising: receiving, from a client device,a blockchain transaction query corresponding to a blockchain transactionquery interface for retrieving the blockchain transaction; obtaining,from a server of the blockchain, the transaction log corresponding tothe blockchain transaction based on the blockchain transaction queryinterface; and retrieving the transaction identifier based on thetransaction log.
 7. The computer-implemented method of claim 6, whereinthe transaction identifier is encrypted by an encryption key associatedwith the service, and the retrieving the transaction identifiercomprises decrypting the transaction identifier based on a decryptionkey corresponding to the encryption key.
 8. A computer-implementedsystem for blockchain transaction processing, comprising: one or moreprocessors; and one or more computer-readable memories coupled to theone or more processors and having instructions stored thereon that areexecutable by the one or more processors to perform operations,comprising: obtaining, by a blockchain node of a blockchain, a currentblockchain transaction generated based on performing a service;invoking, by the blockchain node, a smart contract corresponding to theservice, wherein the smart contract comprises a table including a listof transaction identifiers of blockchain transactions corresponding tothe service; obtaining, by the blockchain node based on executing thesmart contract, a transaction identifier of a previous blockchaintransaction, wherein the previous blockchain transaction corresponds toan identifier record recently added to the list of transactionidentifiers in the table; recording, by the blockchain node, thetransaction identifier of the previous blockchain transaction into atransaction log so that a previous blockchain transaction isidentifiable from the transaction log based on the transactionidentifier; and recording, by the blockchain node, the currentblockchain transaction and the transaction log into the blockchain. 9.The computer-implemented system of claim 8, wherein the transactionidentifier is a hash value of the previous blockchain transaction. 10.The computer-implemented system of claim 8, wherein the previousblockchain transaction is identifiable from the list of transactionidentifiers of blockchain transactions corresponding to the service. 11.The computer-implemented system of claim 8, wherein the list oftransaction identifiers of blockchain transactions corresponding to theservice is updated based on adding a transaction identifier of thecurrent blockchain transaction into the list, and the transactionidentifier of the previous blockchain transaction is updated in the listas the transaction identifier of the current blockchain transactionafter recording the current blockchain transaction into the blockchain.12. The computer-implemented system of claim 8, wherein the transactionidentifier is encrypted by an encryption key associated with the servicebefore recording into the transaction log.
 13. The computer-implementedsystem of claim 8, further comprising: receiving, from a client device,a blockchain transaction query corresponding to a blockchain transactionquery interface for retrieving the blockchain transaction; obtaining,from a server of the blockchain, the transaction log corresponding tothe blockchain transaction based on the blockchain transaction queryinterface; and retrieving the transaction identifier based on thetransaction log.
 14. The computer-implemented system of claim 13,wherein the transaction identifier is encrypted by an encryption keyassociated with the service, and the retrieving the transactionidentifier comprises decrypting the transaction identifier based on adecryption key corresponding to the encryption key.
 15. Anon-transitory, computer-readable medium storing one or moreinstructions executable by a computer-implemented authentication systemto perform one or more operations for blockchain transaction processing,comprising: obtaining, by a blockchain node of a blockchain, a currentblockchain transaction generated based on performing a service;invoking, by the blockchain node, a smart contract corresponding to theservice, wherein the smart contract comprises a table including a listof transaction identifiers of blockchain transactions corresponding tothe service; obtaining, by the blockchain node based on executing thesmart contract, a transaction identifier of a previous blockchaintransaction, wherein the previous blockchain transaction corresponds toan identifier record recently added to the list of transactionidentifiers in the table; recording, by the blockchain node, thetransaction identifier of the previous blockchain transaction into atransaction log so that a previous blockchain transaction isidentifiable from the transaction log based on the transactionidentifier; and recording, by the blockchain node, the currentblockchain transaction and the transaction log into the blockchain. 16.The non-transitory, computer-readable medium of claim 15, wherein thetransaction identifier is a hash value of the previous blockchaintransaction.
 17. The non-transitory, computer-readable medium of claim15, the previous blockchain transaction is identifiable from the list oftransaction identifiers of blockchain transactions corresponding to theservice.
 18. The non-transitory, computer-readable medium of claim 15,wherein the list of transaction identifiers of blockchain transactionscorresponding to the service is updated based on adding a transactionidentifier of the current blockchain transaction into the list, and thetransaction identifier of the previous blockchain transaction is updatedin the list as the transaction identifier of the current blockchaintransaction after recording the current blockchain transaction into theblockchain.
 19. The non-transitory, computer-readable medium of claim15, wherein the transaction identifier is encrypted by an encryption keyassociated with the service before recording into the transaction log.20. The non-transitory, computer-readable medium of claim 15, furthercomprising: receiving, from a client device, a blockchain transactionquery corresponding to a blockchain transaction query interface forretrieving the blockchain transaction; obtaining, from a server of theblockchain, the transaction log corresponding to the blockchaintransaction based on the blockchain transaction query interface; andretrieving the transaction identifier based on the transaction log. 21.The non-transitory, computer-readable medium of claim 20, wherein thetransaction identifier is encrypted by an encryption key associated withthe service, and the retrieving the transaction identifier comprisesdecrypting the transaction identifier based on a decryption keycorresponding to the encryption key.